home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / DriverServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-15  |  7.4 KB  |  190 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        DriverServices.h
  3.  
  4.      Contains:    Driver Services Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2.
  7.                  Package:    Universal Interfaces 2.1.2 on ETO #20
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __DRIVERSERVICES__
  21. #define __DRIVERSERVICES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __KERNEL__
  30. #include <Kernel.h>
  31. #endif
  32. /*    #include <Errors.h>                                            */
  33. /*    #include <MachineExceptions.h>                                */
  34.  
  35. #ifndef __MENUS__
  36. #include <Menus.h>
  37. #endif
  38. /*    #include <Memory.h>                                            */
  39. /*        #include <MixedMode.h>                                    */
  40. /*    #include <Quickdraw.h>                                        */
  41. /*        #include <QuickdrawText.h>                                */
  42.  
  43. #ifndef __CONTROLS__
  44. #include <Controls.h>
  45. #endif
  46.  
  47. #ifndef __DEVICES__
  48. #include <Devices.h>
  49. #endif
  50. /*    #include <OSUtils.h>                                        */
  51. /*    #include <Files.h>                                            */
  52. /*    #include <Events.h>                                            */
  53. /*    #include <Dialogs.h>                                        */
  54. /*        #include <Windows.h>                                    */
  55. /*        #include <TextEdit.h>                                    */
  56. /*    #include <NameRegistry.h>                                    */
  57. /*    #include <CodeFragments.h>                                    */
  58.  
  59. #ifndef __OSUTILS__
  60. #include <OSUtils.h>
  61. #endif
  62.  
  63. #ifndef __MACHINEEXCEPTIONS__
  64. #include <MachineExceptions.h>
  65. #endif
  66.  
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70.  
  71. #if PRAGMA_ALIGN_SUPPORTED
  72. #pragma options align=mac68k
  73. #endif
  74.  
  75. #if PRAGMA_IMPORT_SUPPORTED
  76. #pragma import on
  77. #endif
  78.  
  79. #define kAAPLDeviceLogicalAddress "AAPL,address"
  80. typedef LogicalAddress *DeviceLogicalAddressPtr;
  81.  
  82.  
  83. enum {
  84.     durationMicrosecond            = -1L,                            /* Microseconds are negative*/
  85.     durationMillisecond            = 1L,                            /* Milliseconds are positive*/
  86.     durationSecond                = 1000L,                        /* 1000 * durationMillisecond*/
  87.     durationMinute                = 60000L,                        /* 60 * durationSecond,*/
  88.     durationHour                = 3600000L,                        /* 60 * durationMinute,*/
  89.     durationDay                    = 86400000L,                    /* 24 * durationHour,*/
  90.     durationNoWait                = 0L,                            /* don't block*/
  91.     durationForever                = 0x7FFFFFFF                    /* no time limit*/
  92. };
  93.  
  94. enum {
  95.     k8BitAccess                    = 0,                            /* access as 8 bit*/
  96.     k16BitAccess                = 1,                            /* access as 16 bit*/
  97.     k32BitAccess                = 2                                /* access as 32 bit*/
  98. };
  99.  
  100. typedef UnsignedWide Nanoseconds;
  101.  
  102. extern OSErr IOCommandIsComplete(IOCommandID ID, OSErr result);
  103. extern OSErr GetIOCommandInfo(IOCommandID ID, IOCommandContents *contents, IOCommandCode *command, IOCommandKind *kind);
  104. extern void BlockCopy(const void *srcPtr, void *destPtr, Size byteCount);
  105. extern LogicalAddress PoolAllocateResident(ByteCount byteSize, Boolean clear);
  106. extern OSStatus PoolDeallocate(LogicalAddress address);
  107. extern ByteCount GetLogicalPageSize(void);
  108. extern ByteCount GetDataCacheLineSize(void);
  109. extern OSStatus FlushProcessorCache(AddressSpaceID spaceID, LogicalAddress base, ByteCount length);
  110. extern void SynchronizeIO(void);
  111. extern LogicalAddress MemAllocatePhysicallyContiguous(ByteCount byteSize, Boolean clear);
  112. extern OSStatus MemDeallocatePhysicallyContiguous(LogicalAddress address);
  113. extern AbsoluteTime UpTime(void);
  114. extern void GetTimeBaseInfo(UInt32 *minAbsoluteTimeDelta, UInt32 *theAbsoluteTimeToNanosecondNumerator, UInt32 *theAbsoluteTimeToNanosecondDenominator, UInt32 *theProcessorToAbsoluteTimeNumerator, UInt32 *theProcessorToAbsoluteTimeDenominator);
  115. extern Nanoseconds AbsoluteToNanoseconds(AbsoluteTime absoluteTime);
  116. extern Duration AbsoluteToDuration(AbsoluteTime absoluteTime);
  117. extern AbsoluteTime NanosecondsToAbsolute(Nanoseconds nanoseconds);
  118. extern AbsoluteTime DurationToAbsolute(Duration duration);
  119. extern AbsoluteTime AddAbsoluteToAbsolute(AbsoluteTime absoluteTime1, AbsoluteTime absoluteTime2);
  120. extern AbsoluteTime SubAbsoluteFromAbsolute(AbsoluteTime leftAbsoluteTime, AbsoluteTime rightAbsoluteTime);
  121. extern AbsoluteTime AddNanosecondsToAbsolute(Nanoseconds nanoseconds, AbsoluteTime absoluteTime);
  122. extern AbsoluteTime AddDurationToAbsolute(Duration duration, AbsoluteTime absoluteTime);
  123. extern AbsoluteTime SubNanosecondsFromAbsolute(Nanoseconds nanoseconds, AbsoluteTime absoluteTime);
  124. extern AbsoluteTime SubDurationFromAbsolute(Duration duration, AbsoluteTime absoluteTime);
  125. extern Nanoseconds AbsoluteDeltaToNanoseconds(AbsoluteTime leftAbsoluteTime, AbsoluteTime rightAbsoluteTime);
  126. extern Duration AbsoluteDeltaToDuration(AbsoluteTime leftAbsoluteTime, AbsoluteTime rightAbsoluteTime);
  127. extern Nanoseconds DurationToNanoseconds(Duration theDuration);
  128. extern Duration NanosecondsToDuration(Nanoseconds theNanoseconds);
  129. extern Boolean CompareAndSwap(UInt32 oldVvalue, UInt32 newValue, UInt32 *OldValueAdr);
  130. extern Boolean TestAndSet(UInt32 bit, UInt8 *startAddress);
  131. extern Boolean TestAndClear(UInt32 bit, UInt8 *startAddress);
  132. extern SInt32 IncrementAtomic(SInt32 *value);
  133. extern SInt32 DecrementAtomic(SInt32 *value);
  134. extern SInt32 AddAtomic(SInt32 amount, SInt32 *value);
  135. extern UInt32 BitAndAtomic(UInt32 mask, UInt32 *value);
  136. extern UInt32 BitOrAtomic(UInt32 mask, UInt32 *value);
  137. extern UInt32 BitXorAtomic(UInt32 mask, UInt32 *value);
  138. extern SInt8 IncrementAtomic8(SInt8 *value);
  139. extern SInt8 DecrementAtomic8(SInt8 *value);
  140. extern SInt8 AddAtomic8(SInt32 amount, SInt8 *value);
  141. extern UInt8 BitAndAtomic8(UInt32 mask, UInt8 *value);
  142. extern UInt8 BitOrAtomic8(UInt32 mask, UInt8 *value);
  143. extern UInt8 BitXorAtomic8(UInt32 mask, UInt8 *value);
  144. extern SInt16 IncrementAtomic16(SInt16 *value);
  145. extern SInt16 DecrementAtomic16(SInt16 *value);
  146. extern SInt16 AddAtomic16(SInt32 amount, SInt16 *value);
  147. extern UInt16 BitAndAtomic16(UInt32 mask, UInt16 *value);
  148. extern UInt16 BitOrAtomic16(UInt32 mask, UInt16 *value);
  149. extern UInt16 BitXorAtomic16(UInt32 mask, UInt16 *value);
  150. extern OSErr PBQueueInit(QHdrPtr qHeader);
  151. extern OSErr PBQueueCreate(QHdrPtr *qHeader);
  152. extern OSErr PBQueueDelete(QHdrPtr qHeader);
  153. extern void PBEnqueue(QElemPtr qElement, QHdrPtr qHeader);
  154. extern OSErr PBEnqueueLast(QElemPtr qElement, QHdrPtr qHeader);
  155. extern OSErr PBDequeue(QElemPtr qElement, QHdrPtr qHeader);
  156. extern OSErr PBDequeueFirst(QHdrPtr qHeader, QElemPtr *theFirstqElem);
  157. extern OSErr PBDequeueLast(QHdrPtr qHeader, QElemPtr *theLastqElem);
  158. extern char *CStrCopy(char *dst, const char *src);
  159. extern StringPtr PStrCopy(StringPtr dst, ConstStr255Param src);
  160. extern char *CStrNCopy(char *dst, const char *src, UInt32 max);
  161. extern StringPtr PStrNCopy(StringPtr dst, ConstStr255Param src, UInt32 max);
  162. extern char *CStrCat(char *dst, const char *src);
  163. extern StringPtr PStrCat(StringPtr dst, ConstStr255Param src);
  164. extern char *CStrNCat(char *dst, const char *src, UInt32 max);
  165. extern StringPtr PStrNCat(StringPtr dst, ConstStr255Param src, UInt32 max);
  166. extern void PStrToCStr(char *dst, ConstStr255Param src);
  167. extern void CStrToPStr(Str255 dst, const char *src);
  168. extern SInt16 CStrCmp(const char *s1, const char *s2);
  169. extern SInt16 PStrCmp(ConstStr255Param str1, ConstStr255Param str2);
  170. extern SInt16 CStrNCmp(const char *s1, const char *s2, UInt32 max);
  171. extern SInt16 PStrNCmp(ConstStr255Param str1, ConstStr255Param str2, UInt32 max);
  172. extern UInt32 CStrLen(const char *src);
  173. extern UInt32 PStrLen(ConstStr255Param src);
  174. extern OSStatus DeviceProbe(void *theSrc, void *theDest, UInt32 AccessType);
  175. extern OSStatus DelayForHardware(AbsoluteTime absoluteTime);
  176.  
  177. #if PRAGMA_IMPORT_SUPPORTED
  178. #pragma import off
  179. #endif
  180.  
  181. #if PRAGMA_ALIGN_SUPPORTED
  182. #pragma options align=reset
  183. #endif
  184.  
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188.  
  189. #endif /* __DRIVERSERVICES__ */
  190.